<template>
  <div class="cart-list">
    <scroll class="content" ref="scroll">
      <cart-list-item v-for="(item,index) of cartList" :key="index" :cartInfo="item" />
    </scroll>
  </div>
</template>

<script>
import cartListItem from "./cart-list-item";

import scroll from "components/content/scroll/scroll";

import { mapGetters } from "vuex";
export default {
  name: "cartList",
  data() {
    return {};
  },
  components: {
    cartListItem,
    scroll
  },
  computed: {
    ...mapGetters(["cartList"])
  },
  activated() {
    // 添加商品后，进入购物车界面，此时scroll计算的可滚动的区域还是空的，需要进行refresh
    this.$refs.scroll.refresh();
  }
};
</script>

<style lang="less" scoped>
.cart-list {
  .content {
    position: absolute;
    left: 0;
    right: 0;
    top: 44px;
    bottom: 89px;
    overflow: hidden;
  }
}
</style>